package com.itheima;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.itheima.entity.Emp;

import java.util.ArrayList;
import java.util.List;


public class EmpParseListener extends AnalysisEventListener<Emp> {

    private List<Emp> empList = new ArrayList<>();

    @Override
    public void invoke(Emp emp, AnalysisContext analysisContext) {
        // 每处理一行数据，调用该方法
        empList.add(emp);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        // 处理完所有数据，调用该方法
        for (Emp emp : empList) {
            System.out.println(emp);
        }
    }
}
